package com.moweilin.mo_gateway.services.impl;

import com.moweilin.mo_gateway.services.IHandlerService;
import com.moweilin.mo_gateway.spi.IConfigProvider;

import java.util.ServiceLoader;

/**
 * Created by moweilin on 2017/2/28.
 */
public class HandlerService implements IHandlerService {
    private static IHandlerService service;
    private ServiceLoader<IConfigProvider> loader;
    public static synchronized IHandlerService getInstance() {
        if (service == null) {
            service = new HandlerService();
        }
        return service;
    }

    private HandlerService() {
        loader = ServiceLoader.load(IConfigProvider.class);
    }

    @Override
    public IConfigProvider getHandlerProvider() {
//        try {
//            Iterator<IConfigProvider> handlerProviderIterator = loader.iterator();
//            while (handlerProviderIterator == null && handlerProviderIterator.hasNext()) {
////                Dictionary d = dictionaries.next();
////                definition = d.getDefinition(word);
//            }
//        }
        return null;
    }
}
